<template>
  <div>container</div>
  <el-text class="mx-1" type="primary" size="large">child传来的值：{{ message }}</el-text>

  <h3>输入内容向child传递参数：</h3>
  <el-input v-model="value" placeholder="请输入内容" style="width: 200px" @input="send"></el-input>

  <micro-app name='my-app' iframe url='http://192.168.2.151:3002/'></micro-app>
</template>

<script setup>
import { onMounted, ref } from 'vue'
import microApp from '@micro-zoe/micro-app'

defineProps({
  msg: String,
})
const value = ref('')
const message = ref('')

onMounted(() => {
  microApp.addDataListener('my-app', (data) => {
    // console.log('来自子应用my-app的数据', data)
    message.value = data.message
  })
})

const send = () => {
  // console.log(value.value, 'value.value----------------');
  microApp.setData('my-app', { value: value.value })
}

</script>



<style scoped>
.read-the-docs {
  color: #888;
}
</style>
